﻿@model ESupervision.ViewModels.DashboardSumarising
@using Microsoft.AspNet.Identity;
@{
    ViewBag.Title = "Teacher Sumarising Dashboard";
}
<h2>Teacher Summarising Dashboard</h2>
<div class="row">
    <div class="col-xs-4">
        <div class="btn-group">
            <button type="button" class="btn btn-warning dropdown-toggle btn-lg" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-envelope" /> Messages <span class="badge">@(Model.TotalInboxMessages + Model.TotalSentMessages)</span><span class="caret"></span></button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="@Url.Action("Sent", "Message")">Sent messages <span class="badge">@Model.TotalSentMessages</span></a></li>
                <li class="divider"></li>
                <li><a href="@Url.Action("Index", "Message")">Received messages <span class="badge">@Model.TotalInboxMessages</span></a></li>
            </ul>
        </div>
    </div>
    <div class="col-xs-4">
        <div class="btn-group">
            <button type="button" class="btn btn-success dropdown-toggle btn-lg" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-book" /> Documents <span class="badge">@(Model.TotalUploadedFiles + Model.TotalComments)</span> <span class="caret"></span></button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="@Url.Action("TeacherIndex", "Document")">Uploaded Files <span class="badge">@Model.TotalUploadedFiles</span></a></li>
                <li class="divider"></li>
                <li><a href="@Url.Action("TeacherIndex", "Document")">Comments <span class="badge">@Model.TotalComments</span></a></li>
            </ul>
        </div>
    </div>
    <div class="col-xs-4">
        <div class="btn-group">
            <button type="button" class="btn btn-primary dropdown-toggle btn-lg" data-toggle="dropdown" aria-expanded="false"><span class="glyphicon glyphicon-user" /> Meetings <span class="badge">@(Model.TotalOrganizers + Model.TotalRequestedMeetings + Model.TotalMeetingNotes)</span> <span class="caret"></span></button>
            <ul class="dropdown-menu" role="menu">
                <li><a href="@Url.Action("Index", "Meeting")">Organized meetings <span class="badge">@Model.TotalOrganizers</span></a></li>
                <li class="divider"></li>
                <li><a href="@Url.Action("Index", "Meeting")">Requested Meetings <span class="badge">@Model.TotalRequestedMeetings</span></a></li>
                <li class="divider"></li>
                <li><a href="@Url.Action("Index", "Meeting")">Meeting Notes <span class="badge">@Model.TotalMeetingNotes</span></a></li>
            </ul>
        </div>
    </div>
</div>

@using (Html.BeginForm())
{
    <div class="row" style="margin-top:50px; text-align:center;">
        <b>Find by name:</b> @Html.TextBox("SearchString")
        <button class="btn btn-success btn-sm" type="submit"><span class="glyphicon glyphicon-search" /> Search</button>
    </div>
}

<div class="row">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title" id="panel-title">Your Students<a class="anchorjs-link" href="#panel-title"><span class="anchorjs-icon"></span></a></h3>
        </div>
        <div class="panel-body">
            <div class="table-responsive">
                <table class="table table-hover table-condensed">
                    <thead>
                        <tr>
                            <th>#</th>
                            <th>@Html.ActionLink("First Name", "TeacherDashboard", new { sortOrder = ViewBag.FstNameSortParm })</th>
                            <th>@Html.ActionLink("Last Name", "TeacherDashboard", new { sortOrder = ViewBag.LstNameSortParm })</th>
                            <th>Phone</th>
                            <th>Email</th>
                            <th>@Html.ActionLink("Enrollment Date", "TeacherDashboard", new { sortOrder = ViewBag.DateSortParm })</th>
                            <th>@Html.ActionLink("Your responsibility", "TeacherDashboard", new { sortOrder = ViewBag.ResponsibilitySortParm })</th>
                            <th></th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            int count = 0;
                            foreach (var item in Model.Students)
                            {
                                count++;
                                <tr onclick="window.document.location='@Url.Action("StudentActivities", new { id = item.Id })'">
                                    <td>@count</td>
                                    <td>@item.FirstName</td>
                                    <td>@item.LastName</td>
                                    <td>@item.Phone</td>
                                    <td>@item.Email</td>
                                    <td>@item.EnrollmentDate</td>
                                    <td>
                                        @if (item.SupervisorUserId == User.Identity.GetUserId())
                                        {
                                            <span class="badge">Supervision</span>
                                        }
                                        else
                                        {
                                            <span class="badge alert-danger">Second Marker</span>
                                        }
                                    </td>
                                    <td>@Html.ActionLink("Details", "StudentActivities", new { id = item.Id }, null)</td>
                                </tr>
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
